package com.dzt.androidframework.utils;

import android.content.Context;

import com.dzt.androidframework.widgets.LoadProgressDlg;

/**
 * Created by M02323 on 2017/9/19.
 */

public class JLoadDlgKit {
	private static LoadProgressDlg progressDlg;

	/**
	 * @param context 无参默认点击外部不可取消
	 */
	public static void showProgressDialog(Context context) {
		showProgressDialog(context, false);
	}

	/**
	 * @param context
	 * @param isCancel 点击返回键是否取消
	 */
	public static void showProgressDialog(Context context, boolean isCancel) {
		if (null == progressDlg) {
			progressDlg = new LoadProgressDlg(context);
		}
		if (!progressDlg.isShowing()) {
			progressDlg.setCancelable(isCancel);
			progressDlg.show();
		}
	}

	public static void hideProgressDialog() {
		if (progressDlg != null && progressDlg.isShowing()) {
			progressDlg.dismiss();
		}
	}
}
